<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Oboe: oboe::AudioStreamErrorCallback Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Oboe
   &#160;<span id="projectnumber">1.5</span>
   </div>
   <div id="projectbrief">A library for creating real-time audio apps on Android</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceoboe.html">oboe</a></li><li class="navelem"><a class="el" href="classoboe_1_1_audio_stream_error_callback.html">AudioStreamErrorCallback</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classoboe_1_1_audio_stream_error_callback-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">oboe::AudioStreamErrorCallback Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="_audio_stream_callback_8h_source.html">AudioStreamCallback.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for oboe::AudioStreamErrorCallback:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classoboe_1_1_audio_stream_error_callback.png" usemap="#oboe::AudioStreamErrorCallback_map" alt=""/>
  <map id="oboe::AudioStreamErrorCallback_map" name="oboe::AudioStreamErrorCallback_map">
<area href="classoboe_1_1_audio_stream_callback.html" alt="oboe::AudioStreamCallback" shape="rect" coords="0,56,197,80"/>
<area href="classoboe_1_1_stabilized_callback.html" alt="oboe::StabilizedCallback" shape="rect" coords="0,112,197,136"/>
  </map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a5ad4b8936746ecbb2160a9389b117fc3"><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a5ad4b8936746ecbb2160a9389b117fc3">onError</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *, <a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>)</td></tr>
<tr class="separator:a5ad4b8936746ecbb2160a9389b117fc3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4eb1e4916b71d8231e97b19898bc9bf0"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a4eb1e4916b71d8231e97b19898bc9bf0">onErrorBeforeClose</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *, <a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>)</td></tr>
<tr class="separator:a4eb1e4916b71d8231e97b19898bc9bf0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76bd3ef3e00396e10c21812003654cfe"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a76bd3ef3e00396e10c21812003654cfe">onErrorAfterClose</a> (<a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *, <a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>)</td></tr>
<tr class="separator:a76bd3ef3e00396e10c21812003654cfe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p><a class="el" href="classoboe_1_1_audio_stream_error_callback.html">AudioStreamErrorCallback</a> defines a callback interface for being alerted when a stream has an error or is disconnected using <code>onError*</code> methods.</p>
<p>It is used with <a class="el" href="classoboe_1_1_audio_stream_builder.html#aacb66f530bfc6f545911b5e169774567">AudioStreamBuilder::setErrorCallback()</a>. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a5ad4b8936746ecbb2160a9389b117fc3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5ad4b8936746ecbb2160a9389b117fc3">&#9670;&nbsp;</a></span>onError()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual bool oboe::AudioStreamErrorCallback::onError </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *&#160;</td>
          <td class="paramname">, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>&#160;</td>
          <td class="paramname">&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This will be called before other <code>onError</code> methods when an error occurs on a stream, such as when the stream is disconnected.</p>
<p>It can be used to override and customize the normal error processing. Use of this method is considered an advanced technique. It might, for example, be used if an app want to use a high level lock when closing and reopening a stream. Or it might be used when an app want to signal a management thread that handles all of the stream state.</p>
<p>If this method returns false it indicates that the stream has *not been stopped and closed by the application. In this case it will be stopped by Oboe in the following way: <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a4eb1e4916b71d8231e97b19898bc9bf0">onErrorBeforeClose()</a> will be called, then the stream will be closed and <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a76bd3ef3e00396e10c21812003654cfe">onErrorAfterClose()</a> will be closed.</p>
<p>If this method returns true it indicates that the stream <em>has</em> been stopped and closed by the application and Oboe will not do this. In that case, the app MUST stop() and close() the stream.</p>
<p>This method will be called on a thread created by Oboe.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr>
    <tr><td class="paramname">error</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>true if the stream has been stopped and closed, false if not </dd></dl>

</div>
</div>
<a id="a76bd3ef3e00396e10c21812003654cfe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a76bd3ef3e00396e10c21812003654cfe">&#9670;&nbsp;</a></span>onErrorAfterClose()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void oboe::AudioStreamErrorCallback::onErrorAfterClose </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *&#160;</td>
          <td class="paramname">, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>&#160;</td>
          <td class="paramname">&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This will be called when an error occurs on a stream, such as when the stream is disconnected, and if <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a5ad4b8936746ecbb2160a9389b117fc3">onError()</a> returns false (indicating that the error has not already been handled).</p>
<p>The underlying AAudio or OpenSL ES stream will already be stopped AND closed by Oboe. So the underlying stream cannot be referenced. But you can still query most parameters.</p>
<p>This callback could be used to reopen a new stream on another device.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr>
    <tr><td class="paramname">error</td><td></td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="classoboe_1_1_stabilized_callback.html#af7521da42c4b08a71e6102994f6f41f4">oboe::StabilizedCallback</a>.</p>

</div>
</div>
<a id="a4eb1e4916b71d8231e97b19898bc9bf0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4eb1e4916b71d8231e97b19898bc9bf0">&#9670;&nbsp;</a></span>onErrorBeforeClose()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void oboe::AudioStreamErrorCallback::onErrorBeforeClose </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classoboe_1_1_audio_stream.html">AudioStream</a> *&#160;</td>
          <td class="paramname">, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="namespaceoboe.html#a486512e787b609c80ba4436f23929af1">Result</a>&#160;</td>
          <td class="paramname">&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This will be called when an error occurs on a stream, such as when the stream is disconnected, and if <a class="el" href="classoboe_1_1_audio_stream_error_callback.html#a5ad4b8936746ecbb2160a9389b117fc3">onError()</a> returns false (indicating that the error has not already been handled).</p>
<p>Note that this will be called on a thread created by Oboe.</p>
<p>The underlying stream will already be stopped by Oboe but not yet closed. So the stream can be queried.</p>
<p>Do not close or delete the stream in this method because it will be closed after this method returns.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">audioStream</td><td>pointer to the associated stream </td></tr>
    <tr><td class="paramname">error</td><td></td></tr>
  </table>
  </dd>
</dl>

<p>Reimplemented in <a class="el" href="classoboe_1_1_stabilized_callback.html#a7ec0e9fca3181962ab78716bcda83e10">oboe::StabilizedCallback</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/oboe/<a class="el" href="_audio_stream_callback_8h_source.html">AudioStreamCallback.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.15
</small></address>
</body>
</html>
